<?php
declare (strict_types = 1);

namespace app\admin\controller\v1\pageConfig;

use app\common\Backend;
use app\common\model\CustomTabbar as ModelCustomTabbar;
use think\Request;

class CustomTabbar extends Backend
{
     /**
     * @var Navigation
     */
    protected $model = null;

    protected $quickSearchField = ['title'];

    public function initialize(): void
    {
        parent::initialize();
        $this->model = new ModelCustomTabbar();
    }

     /**
     * 数据源
     * @throws Throwable
     */
    public function index(): void
    {
        if ($this->request->param('select')) {
            $this->select();
        }

        list($where, $alias, $limit, $order) = $this->queryBuilder();
        $res = $this->model
            ->withJoin($this->withJoinTable, $this->withJoinType)
            ->alias($alias)
            ->where($where)
            ->order($order)
            ->paginate($limit);

        $this->success('', [
            'list'   => $res->items(),
            'total'  => $res->total(),
            'remark' => '',
        ]);
    }
}
